home *** CD-ROM | disk | FTP | other *** search
/ Interactive CD-ROM & Web Magazine 6 / Interactive CD-ROM & Web Magazine 6.iso / pc / wingift / imaging / imgsamp.fr_ / imgsamp.fr
Text File  |  1995-12-21  |  42KB  |  1,577 lines

  1. VERSION 4.00
  2. Begin VB.Form frmSample 
  3.    Caption         =   "Image Edit"
  4.    ClientHeight    =   4152
  5.    ClientLeft      =   1560
  6.    ClientTop       =   1776
  7.    ClientWidth     =   6660
  8.    DrawStyle       =   5  'Transparent
  9.    Height          =   4824
  10.    Left            =   1512
  11.    LinkTopic       =   "Form1"
  12.    LockControls    =   -1  'True
  13.    ScaleHeight     =   4152
  14.    ScaleWidth      =   6660
  15.    Top             =   1152
  16.    Width           =   6756
  17.    Begin ImgeditLibCtl.ImgEdit oleImgEdit1 
  18.       Height          =   4092
  19.       Left            =   0
  20.       TabIndex        =   1
  21.       Top             =   0
  22.       Width           =   6612
  23.       _version        =   65536
  24.       _extentx        =   11663
  25.       _extenty        =   7218
  26.       _stockprops     =   0
  27.       imagecontrol    =   "ImgEdit1"
  28.    End
  29.    Begin ThumbnailLibCtl.ImgThumbnail oleImgThumbnail1 
  30.       Height          =   324
  31.       Left            =   0
  32.       TabIndex        =   0
  33.       Top             =   0
  34.       Visible         =   0   'False
  35.       Width           =   6612
  36.       _version        =   65536
  37.       _extentx        =   11663
  38.       _extenty        =   572
  39.       _stockprops     =   0
  40.       backcolor       =   -2147483638
  41.    End
  42.    Begin AdminLibCtl.ImgAdmin oleImgAdmin1 
  43.       Left            =   3600
  44.       Top             =   732
  45.       _version        =   65536
  46.       _extentx        =   4890
  47.       _extenty        =   402
  48.       _stockprops     =   0
  49.    End
  50.    Begin VB.Menu mnuFile 
  51.       Caption         =   "&File"
  52.       Begin VB.Menu mnuNew 
  53.          Caption         =   "&New"
  54.       End
  55.       Begin VB.Menu mnuOpen 
  56.          Caption         =   "&Open..."
  57.       End
  58.       Begin VB.Menu mnuSave 
  59.          Caption         =   "&Save"
  60.          Enabled         =   0   'False
  61.       End
  62.       Begin VB.Menu mnuSaveAs 
  63.          Caption         =   "Save &As..."
  64.          Enabled         =   0   'False
  65.       End
  66.       Begin VB.Menu mnuSep2 
  67.          Caption         =   "-"
  68.       End
  69.       Begin VB.Menu mnuPrint 
  70.          Caption         =   "&Print..."
  71.          Enabled         =   0   'False
  72.       End
  73.       Begin VB.Menu mnuSend 
  74.          Caption         =   "&Send..."
  75.          Enabled         =   0   'False
  76.       End
  77.       Begin VB.Menu mnuSep3 
  78.          Caption         =   "-"
  79.       End
  80.       Begin VB.Menu mnuExit 
  81.          Caption         =   "E&xit"
  82.       End
  83.    End
  84.    Begin VB.Menu mnuEdit 
  85.       Caption         =   "&Edit"
  86.       Enabled         =   0   'False
  87.       Begin VB.Menu mnuCut 
  88.          Caption         =   "Cu&t"
  89.       End
  90.       Begin VB.Menu mnuCopy 
  91.          Caption         =   "&Copy"
  92.       End
  93.       Begin VB.Menu mnuCopyPage 
  94.          Caption         =   "Cop&y Page"
  95.          Enabled         =   0   'False
  96.       End
  97.       Begin VB.Menu mnuPaste 
  98.          Caption         =   "&Paste"
  99.       End
  100.       Begin VB.Menu mnuDeletePage 
  101.          Caption         =   "&Delete Page"
  102.          Enabled         =   0   'False
  103.       End
  104.       Begin VB.Menu mnuSep4 
  105.          Caption         =   "-"
  106.       End
  107.       Begin VB.Menu mnuSelect 
  108.          Caption         =   "&Select"
  109.          Checked         =   -1  'True
  110.       End
  111.       Begin VB.Menu mnuDrag 
  112.          Caption         =   "&Drag"
  113.          Enabled         =   0   'False
  114.       End
  115.    End
  116.    Begin VB.Menu mnuView 
  117.       Caption         =   "&View"
  118.       Enabled         =   0   'False
  119.       Begin VB.Menu mnuScaleToGray 
  120.          Caption         =   "Scale to &Gray"
  121.       End
  122.       Begin VB.Menu mnuSep12 
  123.          Caption         =   "-"
  124.       End
  125.       Begin VB.Menu mnuOnePage 
  126.          Caption         =   "&One Page"
  127.          Checked         =   -1  'True
  128.       End
  129.       Begin VB.Menu mnuThumbnail 
  130.          Caption         =   "&Thumbnail"
  131.       End
  132.       Begin VB.Menu mnuPageThumbnail 
  133.          Caption         =   "&Page and Thumbnail"
  134.       End
  135.       Begin VB.Menu mnuSep7 
  136.          Caption         =   "-"
  137.       End
  138.       Begin VB.Menu mnuFullScreen 
  139.          Caption         =   "&Full Screen"
  140.       End
  141.       Begin VB.Menu mnuSep6 
  142.          Caption         =   "-"
  143.       End
  144.       Begin VB.Menu mnuToolbar 
  145.          Caption         =   "&Toolbar"
  146.          Enabled         =   0   'False
  147.       End
  148.       Begin VB.Menu mnuSep5 
  149.          Caption         =   "-"
  150.       End
  151.       Begin VB.Menu mnuOptions 
  152.          Caption         =   "Options..."
  153.          Enabled         =   0   'False
  154.       End
  155.    End
  156.    Begin VB.Menu mnuPage 
  157.       Caption         =   "&Page"
  158.       Enabled         =   0   'False
  159.       Begin VB.Menu mnuNext 
  160.          Caption         =   "&Next"
  161.       End
  162.       Begin VB.Menu mnuPrevious 
  163.          Caption         =   "&Previous"
  164.       End
  165.       Begin VB.Menu mnuFirst 
  166.          Caption         =   "&First"
  167.       End
  168.       Begin VB.Menu mnuLast 
  169.          Caption         =   "&Last"
  170.       End
  171.       Begin VB.Menu mnuSep11 
  172.          Caption         =   "-"
  173.       End
  174.       Begin VB.Menu mnuGoTo 
  175.          Caption         =   "&Go To..."
  176.       End
  177.       Begin VB.Menu mnuBack 
  178.          Caption         =   "Go &Back"
  179.       End
  180.       Begin VB.Menu mnuSep10 
  181.          Caption         =   "-"
  182.       End
  183.       Begin VB.Menu mnuPrintPage 
  184.          Caption         =   "Prin&t Page"
  185.       End
  186.       Begin VB.Menu mnuSep9 
  187.          Caption         =   "-"
  188.       End
  189.       Begin VB.Menu mnuLeft 
  190.          Caption         =   "Rotate &Left"
  191.       End
  192.       Begin VB.Menu mnuRight 
  193.          Caption         =   "Rotate &Right"
  194.       End
  195.       Begin VB.Menu mnuFlip 
  196.          Caption         =   "&Flip"
  197.       End
  198.       Begin VB.Menu mnuSep8 
  199.          Caption         =   "-"
  200.       End
  201.       Begin VB.Menu mnuInsert 
  202.          Caption         =   "&Insert..."
  203.          Enabled         =   0   'False
  204.       End
  205.       Begin VB.Menu mnuAppend 
  206.          Caption         =   "&Append..."
  207.          Enabled         =   0   'False
  208.       End
  209.       Begin VB.Menu mnuSep 
  210.          Caption         =   "-"
  211.       End
  212.       Begin VB.Menu mnuConvert 
  213.          Caption         =   "&Convert..."
  214.          Enabled         =   0   'False
  215.       End
  216.       Begin VB.Menu mnuRescan 
  217.          Caption         =   "&Rescan"
  218.          Enabled         =   0   'False
  219.       End
  220.    End
  221.    Begin VB.Menu mnuZoom 
  222.       Caption         =   "&Zoom"
  223.       Enabled         =   0   'False
  224.       Begin VB.Menu mnuZoomIn 
  225.          Caption         =   "Zoom &In"
  226.       End
  227.       Begin VB.Menu mnuZoomOut 
  228.          Caption         =   "Zoom &Out"
  229.       End
  230.       Begin VB.Menu mnuZoomToSelection 
  231.          Caption         =   "Zoom to &Selection"
  232.       End
  233.       Begin VB.Menu mnuSep13 
  234.          Caption         =   "-"
  235.       End
  236.       Begin VB.Menu mnuFitHeight 
  237.          Caption         =   "Fit to &Height"
  238.       End
  239.       Begin VB.Menu mnuFitWidth 
  240.          Caption         =   "Fit to &Width"
  241.       End
  242.       Begin VB.Menu mnuBestFit 
  243.          Caption         =   "&Best Fit"
  244.       End
  245.       Begin VB.Menu mnuActual 
  246.          Caption         =   "Act&ual Size"
  247.       End
  248.       Begin VB.Menu mnuSep14 
  249.          Caption         =   "-"
  250.       End
  251.       Begin VB.Menu mnu25 
  252.          Caption         =   "&25%"
  253.       End
  254.       Begin VB.Menu mnu50 
  255.          Caption         =   "&50%"
  256.       End
  257.       Begin VB.Menu mnu75 
  258.          Caption         =   "&75%"
  259.       End
  260.       Begin VB.Menu mnu100 
  261.          Caption         =   "&100%"
  262.       End
  263.       Begin VB.Menu mnu200 
  264.          Caption         =   "2&00%"
  265.       End
  266.       Begin VB.Menu mnu400 
  267.          Caption         =   "&400%"
  268.       End
  269.       Begin VB.Menu mnuCustom 
  270.          Caption         =   "&Custom..."
  271.          Enabled         =   0   'False
  272.       End
  273.    End
  274.    Begin VB.Menu mnuAnnotation 
  275.       Caption         =   "&Annotation"
  276.       Enabled         =   0   'False
  277.       Begin VB.Menu mnuHideAnnotation 
  278.          Caption         =   "&Hide Annotation"
  279.       End
  280.       Begin VB.Menu mnuBurnIn 
  281.          Caption         =   "B&urn in Annotation"
  282.       End
  283.       Begin VB.Menu mnuSep15 
  284.          Caption         =   "-"
  285.       End
  286.       Begin VB.Menu mnuNoTool 
  287.          Caption         =   "&No Tool"
  288.       End
  289.       Begin VB.Menu mnuSelectPointer 
  290.          Caption         =   "Selection &Pointer"
  291.       End
  292.       Begin VB.Menu mnuFreeHand 
  293.          Caption         =   "&Freehand Line"
  294.       End
  295.       Begin VB.Menu mnuHiLight 
  296.          Caption         =   "H&ighlight Line"
  297.       End
  298.       Begin VB.Menu mnuStraightLine 
  299.          Caption         =   "Straight &Line"
  300.       End
  301.       Begin VB.Menu mnuHollowRect 
  302.          Caption         =   "Hollow &Rectangle"
  303.       End
  304.       Begin VB.Menu mnuFillRect 
  305.          Caption         =   "Filled Rectan&gle"
  306.       End
  307.       Begin VB.Menu mnuTypedText 
  308.          Caption         =   "Typed Text"
  309.       End
  310.       Begin VB.Menu mnuAttachNote 
  311.          Caption         =   "Atta&ch-a-note"
  312.       End
  313.       Begin VB.Menu mnuTextFromFile 
  314.          Caption         =   "Te&xt from File"
  315.       End
  316.       Begin VB.Menu mnuStamp 
  317.          Caption         =   "Ru&bber Stamps"
  318.       End
  319.       Begin VB.Menu mnuSep16 
  320.          Caption         =   "-"
  321.       End
  322.       Begin VB.Menu mnuShowTools 
  323.          Caption         =   "Show Toolbox"
  324.       End
  325.    End
  326.    Begin VB.Menu mnuHelp 
  327.       Caption         =   "&Help"
  328.       Enabled         =   0   'False
  329.       Begin VB.Menu mnuAbout 
  330.          Caption         =   "&About..."
  331.          Enabled         =   0   'False
  332.       End
  333.    End
  334. End
  335. Attribute VB_Name = "frmSample"
  336. Attribute VB_Creatable = False
  337. Attribute VB_Exposed = False
  338. ' ------------------------------------------------------------------------
  339. '               Copyright (C) 1995 Wang
  340. '
  341. ' You have a royalty-free right to use, modify, reproduce and distribute
  342. ' the Sample Application Files (and/or any modified version) in any way
  343. ' you find useful, provided that you agree that Wang has no warranty,
  344. ' obligations or liability for any Sample Application Files.
  345. '
  346. ' This application is intended as an example of how to use the Wang
  347. ' Imaging OLE Controls.  As such, we have kept refinements such as
  348. ' disabling and enabling menu items, elaborate error handling, etc. to
  349. ' a minimum so as not to obscure the code that actually deals with the
  350. ' Wang Imaging OLE controls.  There are items on the menus that have
  351. ' not been implemented.  These items, in general, would involve creating
  352. ' dialog boxes and other UI that are best left to the user.  Once the user
  353. ' has an understanding of how to use the Wang Imaging Controls, these
  354. ' items should be fairly simple to implement.
  355. ' ------------------------------------------------------------------------
  356.  
  357. Dim Selection As Boolean 'Selection = True, selection rect drawn.
  358. Dim Annot8Visible As Boolean 'Annot8Visible = True, annotation toolbox is
  359.                             'visible
  360. Dim CurrentPage As Integer 'CurPage = currently displayed image page
  361. Dim LastPage As Integer 'LastPage = last page viewed before current page
  362. Dim TotalPages As Integer 'TotalPages = image document page count
  363. Dim numbits As Integer 'number of bits per pixel supported by this device
  364.  
  365. 'Const defines
  366. Const NoTool = 0
  367. Const AnnoSelection = 1
  368. Const AnnoFreehand = 2
  369. Const AnnoHiLight = 3
  370. Const AnnoStraightLine = 4
  371. Const AnnoHollowRect = 5
  372. Const AnnoFilledRect = 6
  373. Const AnnoText = 7
  374. Const AnnoAttachNote = 8
  375. Const AnnoTextFromFile = 9
  376. Const AnnoRubberStamp = 10
  377. Const BestFit = 0
  378. Const FitWidth = 1
  379. Const FitHeight = 2
  380. Const InchToInch = 3
  381. Const ErrCancel = 32755
  382. Const ZoomMax = 6554
  383. Const ZoomMin = 2
  384. Const TiffImage = 1
  385. Const AwdImage = 2
  386. Const BmpImage = 3
  387. Const ImageChanged = "Image has changed.  Do you want to save changes?"
  388.  
  389. 'Win API to determine display capabilities
  390. Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Integer, ByVal nIndex As Integer) As Integer
  391.  
  392. Private Sub Form_Load()
  393. 'initialize the variables
  394. Dim dc As Long
  395. Dim index As Long
  396.  
  397. Selection = False
  398. Annot8Visible = False
  399. CurrentPage = 1
  400. LastPage = 1
  401. TotalPages = 1
  402.  
  403. dc = hdc
  404. index = 12  '12 = BITSPERPIXEL
  405. numbits = GetDeviceCaps(dc, index) 'finds out how many colors video driver supports
  406.  
  407. End Sub
  408.  
  409. Private Sub Form_Resize()
  410. 'when the form is resized, position the Image Edit
  411. 'control window and\or the ThumbNail control window
  412. 'so that they fit within the new form
  413. 'dimensions.
  414.  
  415. If frmSample.WindowState = 1 Or frmSample.ScaleWidth < 1 Or frmSample.ScaleHeight < 1 Then
  416.     Exit Sub 'leave if app is being minimized or the form is too small
  417. End If
  418. If mnuOnePage.Checked Then 'Just image displayed
  419.     oleImgEdit1.Left = frmSample.ScaleLeft
  420.     oleImgEdit1.Top = frmSample.ScaleTop
  421.     oleImgEdit1.Width = frmSample.ScaleWidth
  422.     oleImgEdit1.Height = frmSample.ScaleHeight
  423.  
  424. ElseIf mnuThumbnail.Checked Then 'Just ThumbNail displayed
  425.     oleImgThumbnail1.Left = frmSample.ScaleLeft
  426.     oleImgThumbnail1.Top = frmSample.ScaleTop
  427.     oleImgThumbnail1.Width = frmSample.ScaleWidth
  428.     oleImgThumbnail1.Height = frmSample.ScaleHeight
  429.  
  430. Else 'Image and ThumbNail displayed. ThumbNail gets 1/3 of frame, Image 2/3.
  431.     oleImgThumbnail1.Left = frmSample.ScaleLeft
  432.     oleImgThumbnail1.Top = frmSample.ScaleTop
  433.     oleImgThumbnail1.Width = frmSample.ScaleWidth
  434.     oleImgThumbnail1.Height = frmSample.ScaleHeight / 3
  435.     oleImgEdit1.Left = frmSample.ScaleLeft
  436.     oleImgEdit1.Top = frmSample.ScaleHeight / 3
  437.     oleImgEdit1.Width = frmSample.ScaleWidth
  438.     oleImgEdit1.Height = (frmSample.ScaleHeight * 2 / 3)
  439.  
  440. End If
  441.  
  442. End Sub
  443.  
  444.  
  445. Private Sub Form_Unload(Cancel As Integer)
  446. 'if image has changed, give the user a chance to
  447. 'save it before closing
  448. If oleImgEdit1.ImageModified = True Then
  449.     If MsgBox(ImageChanged, vbYesNo) = vbYes Then
  450.         mnuSave_Click
  451.     End If
  452. End If
  453.  
  454. End Sub
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461. Private Sub mnu100_Click()
  462. 'Set zoom to 100% and redisplay image.
  463. 'Zoom value is a float
  464. oleImgEdit1.Zoom = 100!
  465. oleImgEdit1.Refresh
  466.  
  467. 'check the current menu pick and uncheck the others.
  468. mnuBestFit.Checked = False
  469. mnuFitHeight.Checked = False
  470. mnuFitWidth.Checked = False
  471. mnuActual.Checked = False
  472. mnu25.Checked = False
  473. mnu50.Checked = False
  474. mnu75.Checked = False
  475. mnu100.Checked = True
  476. mnu200.Checked = False
  477. mnu400.Checked = False
  478. End Sub
  479.  
  480.  
  481. Private Sub mnu200_Click()
  482. 'Set zoom to 200% and redisplay image.
  483. 'Zoom value is a float
  484. oleImgEdit1.Zoom = 200!
  485. oleImgEdit1.Refresh
  486.  
  487. 'check the current menu pick and uncheck the others.
  488. mnuBestFit.Checked = False
  489. mnuFitHeight.Checked = False
  490. mnuFitWidth.Checked = False
  491. mnuActual.Checked = False
  492. mnu25.Checked = False
  493. mnu50.Checked = False
  494. mnu75.Checked = False
  495. mnu100.Checked = False
  496. mnu200.Checked = True
  497. mnu400.Checked = False
  498. End Sub
  499.  
  500.  
  501. Private Sub mnu25_Click()
  502. 'Set zoom to 25% and redisplay image.
  503. 'Zoom value is a float
  504. oleImgEdit1.Zoom = 25!
  505. oleImgEdit1.Refresh
  506.  
  507. 'check the current menu pick and uncheck the others.
  508. mnuBestFit.Checked = False
  509. mnuFitHeight.Checked = False
  510. mnuFitWidth.Checked = False
  511. mnuActual.Checked = False
  512. mnu25.Checked = True
  513. mnu50.Checked = False
  514. mnu75.Checked = False
  515. mnu100.Checked = False
  516. mnu200.Checked = False
  517. mnu400.Checked = False
  518. End Sub
  519.  
  520.  
  521. Private Sub mnu400_Click()
  522. 'Set zoom to 400% and redisplay image.
  523. 'Zoom value is a float
  524. oleImgEdit1.Zoom = 400!
  525. oleImgEdit1.Refresh
  526.  
  527. 'check the current menu pick and uncheck the others.
  528. mnuBestFit.Checked = False
  529. mnuFitHeight.Checked = False
  530. mnuFitWidth.Checked = False
  531. mnuActual.Checked = False
  532. mnu25.Checked = False
  533. mnu50.Checked = False
  534. mnu75.Checked = False
  535. mnu100.Checked = False
  536. mnu200.Checked = False
  537. mnu400.Checked = True
  538. End Sub
  539.  
  540.  
  541. Private Sub mnu50_Click()
  542. 'Set zoom to 50% and redisplay image.
  543. 'Zoom value is a float
  544. oleImgEdit1.Zoom = 50!
  545. oleImgEdit1.Refresh
  546.  
  547. 'check the current menu pick and uncheck the others.
  548. mnuBestFit.Checked = False
  549. mnuFitHeight.Checked = False
  550. mnuFitWidth.Checked = False
  551. mnuActual.Checked = False
  552. mnu25.Checked = False
  553. mnu50.Checked = True
  554. mnu75.Checked = False
  555. mnu100.Checked = False
  556. mnu200.Checked = False
  557. mnu400.Checked = False
  558. End Sub
  559.  
  560.  
  561. Private Sub mnu75_Click()
  562. 'Set zoom to 75% and redisplay image.
  563. 'Zoom value is a float
  564. oleImgEdit1.Zoom = 75!
  565. oleImgEdit1.Refresh
  566.  
  567. 'check the current menu pick and uncheck the others.
  568. mnuBestFit.Checked = False
  569. mnuFitHeight.Checked = False
  570. mnuFitWidth.Checked = False
  571. mnuActual.Checked = False
  572. mnu25.Checked = False
  573. mnu50.Checked = False
  574. mnu75.Checked = True
  575. mnu100.Checked = False
  576. mnu200.Checked = False
  577. mnu400.Checked = False
  578. End Sub
  579.  
  580.  
  581. Private Sub mnuAbout_Click()
  582. 'Add your code here
  583. MsgBox "Function to be implemented by user."
  584. End Sub
  585.  
  586.  
  587. Private Sub mnuActual_Click()
  588. 'Set fit to inch to inch and redisplay image.
  589. oleImgEdit1.FitTo (InchToInch)
  590. oleImgEdit1.Refresh
  591.  
  592. 'check the current zoom menu pick and uncheck the others.
  593. mnuBestFit.Checked = False
  594. mnuFitHeight.Checked = False
  595. mnuFitWidth.Checked = False
  596. mnuActual.Checked = True
  597. mnu25.Checked = False
  598. mnu50.Checked = False
  599. mnu75.Checked = False
  600. mnu100.Checked = False
  601. mnu200.Checked = False
  602. mnu400.Checked = False
  603. End Sub
  604.  
  605.  
  606. Private Sub mnuAppend_Click()
  607. 'Add your code here.
  608. MsgBox "Function to be implemented by user."
  609.  
  610. End Sub
  611.  
  612.  
  613. Private Sub mnuAttachNote_Click()
  614. 'see documentation for the list of annotation types
  615. oleImgEdit1.SelectTool AnnoAttachNote
  616.  
  617.  
  618. 'Check the current annotation tool and uncheck all
  619. 'the others
  620. mnuNoTool.Checked = False
  621. mnuSelectPointer.Checked = False
  622. mnuAttachNote.Checked = True
  623. mnuFillRect.Checked = False
  624. mnuFreeHand.Checked = False
  625. mnuHiLight.Checked = False
  626. mnuHollowRect.Checked = False
  627. mnuStamp.Checked = False
  628. mnuStraightLine.Checked = False
  629. mnuTextFromFile.Checked = False
  630. mnuTypedText.Checked = False
  631.  
  632. End Sub
  633.  
  634.  
  635. Private Sub mnuBack_Click()
  636. 'Save current page if modified, then return to the
  637. 'previously displayed page.
  638. If oleImgEdit1.ImageModified = True Then
  639.     If MsgBox(ImageChanged, vbYesNo) = vbYes Then
  640.         mnuSave_Click
  641.     End If
  642. End If
  643. oleImgEdit1.page = LastPage
  644. oleImgEdit1.Display
  645.  
  646. 'Update the selected page thumbnail
  647. oleImgThumbnail1.DeselectAllThumbs
  648. oleImgThumbnail1.ThumbSelected(LastPage) = True
  649.  
  650. End Sub
  651.  
  652.  
  653. Private Sub mnuBestFit_Click()
  654. 'zoom the image so that the entire image
  655. 'fits in the display window
  656. oleImgEdit1.FitTo (BestFit)
  657.  
  658. 'check the current menu pick and uncheck the others.
  659. mnuBestFit.Checked = True
  660. mnuFitHeight.Checked = False
  661. mnuFitWidth.Checked = False
  662. mnuZoomToSelection.Checked = False
  663. mnu25.Checked = False
  664. mnu50.Checked = False
  665. mnu75.Checked = False
  666. mnu100.Checked = False
  667. mnu200.Checked = False
  668. mnu400.Checked = False
  669. End Sub
  670.  
  671.  
  672. Private Sub mnuBurnIn_Click()
  673. 'burn in all visible annotations,(1,) and preserve
  674. 'colors, (2).  See documentation for other valid arguments.
  675. ret = oleImgEdit1.BurnInAnnotations(1, 2)
  676.  
  677. End Sub
  678.  
  679.  
  680. Private Sub mnuConvert_Click()
  681. 'Add your code here.
  682. MsgBox "Function to be implemented by user."
  683. End Sub
  684.  
  685. Private Sub mnuCopy_Click()
  686. 'Copy the selected area to the clipboard.
  687. If Selection = True Then
  688.     oleImgEdit1.ClipboardCopy
  689. End If
  690. End Sub
  691.  
  692.  
  693. Private Sub mnuCopyPage_Click()
  694. 'Add your code here.
  695. MsgBox "Function to be implemented by user."
  696.  
  697. End Sub
  698.  
  699.  
  700. Private Sub mnuCustom_Click()
  701. 'Add your code here.
  702. MsgBox "Function to be implemented by user."
  703.  
  704. End Sub
  705.  
  706.  
  707. Private Sub mnuCut_Click()
  708. 'Cut the selected area to the clipboard.
  709. If Selection = True Then
  710.     oleImgEdit1.ClipboardCut
  711. End If
  712.  
  713. End Sub
  714.  
  715.  
  716. Private Sub mnuDeletePage_Click()
  717. 'Add your code here.
  718. MsgBox "Function to be implemented by user."
  719.  
  720. End Sub
  721.  
  722. Private Sub mnuDrag_Click()
  723. 'Add your code here.
  724. MsgBox "Function to be implemented by user."
  725.  
  726. End Sub
  727.  
  728.  
  729. Private Sub mnuExit_Click()
  730. 'Close the app
  731.  
  732. Unload frmSample
  733.  
  734. End Sub
  735.  
  736. Private Sub mnuFillRect_Click()
  737. 'see documentation for the list of annotation types
  738. oleImgEdit1.SelectTool AnnoFilledRect
  739.  
  740.  
  741. 'Check the current annotation tool and uncheck all
  742. 'the others
  743. mnuNoTool.Checked = False
  744. mnuSelectPointer.Checked = False
  745. mnuAttachNote.Checked = False
  746. mnuFillRect.Checked = True
  747. mnuFreeHand.Checked = False
  748. mnuHiLight.Checked = False
  749. mnuHollowRect.Checked = False
  750. mnuStamp.Checked = False
  751. mnuStraightLine.Checked = False
  752. mnuTextFromFile.Checked = False
  753. mnuTypedText.Checked = False
  754.  
  755. End Sub
  756.  
  757. Private Sub mnuFirst_Click()
  758. 'Save current page if modified, then store the current
  759. 'page number and display the first page
  760. If oleImgEdit1.ImageModified = True Then
  761.     If MsgBox(ImageChanged, vbYesNo) = vbYes Then
  762.         mnuSave_Click
  763.     End If
  764. End If
  765. LastPage = oleImgEdit1.page
  766. oleImgEdit1.page = 1
  767. oleImgEdit1.Display
  768.  
  769. 'Update the selected page thumbnail
  770. oleImgThumbnail1.DeselectAllThumbs
  771. oleImgThumbnail1.ThumbSelected(1) = True
  772. End Sub
  773.  
  774. Private Sub mnuFitHeight_Click()
  775. 'Zoom the image so that its vertical
  776. 'dimension fits within the display window
  777. oleImgEdit1.FitTo (FitHeight)
  778.  
  779. 'check the current menu pick and uncheck the others.
  780. mnuBestFit.Checked = False
  781. mnuFitHeight.Checked = True
  782. mnuFitWidth.Checked = False
  783. mnuZoomToSelection.Checked = False
  784. mnu25.Checked = False
  785. mnu50.Checked = False
  786. mnu75.Checked = False
  787. mnu100.Checked = False
  788. mnu200.Checked = False
  789. mnu400.Checked = False
  790. End Sub
  791.  
  792. Private Sub mnuFitWidth_Click()
  793. 'Zoom the image so that its horizontal
  794. 'dimension fits within the display window
  795. oleImgEdit1.FitTo (FitWidth)
  796.  
  797. 'check the current menu pick and uncheck the others.
  798. mnuBestFit.Checked = False
  799. mnuFitHeight.Checked = False
  800. mnuFitWidth.Checked = True
  801. mnuZoomToSelection.Checked = False
  802. mnu25.Checked = False
  803. mnu50.Checked = False
  804. mnu75.Checked = False
  805. mnu100.Checked = False
  806. mnu200.Checked = False
  807. mnu400.Checked = False
  808. End Sub
  809.  
  810. Private Sub mnuFlip_Click()
  811. 'Rotate the image 180 degrees.
  812. oleImgEdit1.Flip
  813. End Sub
  814.  
  815. Private Sub mnuFreeHand_Click()
  816. 'see documentation for the list of annotation types
  817. oleImgEdit1.SelectTool AnnoFreehand
  818.  
  819.  
  820. 'Check the current annotation tool and uncheck all
  821. 'the others
  822. mnuNoTool.Checked = False
  823. mnuSelectPointer.Checked = False
  824. mnuAttachNote.Checked = False
  825. mnuFillRect.Checked = False
  826. mnuFreeHand.Checked = True
  827. mnuHiLight.Checked = False
  828. mnuHollowRect.Checked = False
  829. mnuStamp.Checked = False
  830. mnuStraightLine.Checked = False
  831. mnuTextFromFile.Checked = False
  832. mnuTypedText.Checked = False
  833.  
  834. End Sub
  835.  
  836. Private Sub mnuFullScreen_Click()
  837. 'resize the Image Edit window to maximize the display
  838.  
  839. If mnuFullScreen.Checked Then
  840.     frmSample.WindowState = 0
  841.     mnuFullScreen.Checked = False
  842. Else
  843.     frmSample.WindowState = 2
  844.     mnuFullScreen.Checked = True
  845. End If
  846. End Sub
  847.  
  848. Private Sub mnuGoTo_Click()
  849. 'Save current page if modified, then store the current
  850. 'page number and display the GoTo Page dialog box
  851. If oleImgEdit1.ImageModified = True Then
  852.     If MsgBox(ImageChanged, vbYesNo) = vbYes Then
  853.         mnuSave_Click
  854.     End If
  855. End If
  856. LastPage = oleImgEdit1.page
  857. frmGotoDlg.Show
  858. End Sub
  859.  
  860. Private Sub mnuHelp_Click()
  861. 'Add your code here.
  862. MsgBox "Function to be implemented by user."
  863.  
  864. End Sub
  865.  
  866.  
  867. Private Sub mnuHideAnnotation_Click()
  868. 'Toggle the display of annotations
  869. If mnuHideAnnotation.Checked = True Then
  870.     'show all hidden annotations
  871.     oleImgEdit1.ShowAnnotationGroup
  872.     oleImgEdit1.Refresh
  873.     mnuHideAnnotation.Checked = False
  874. Else
  875.     'hide all displayed annotations
  876.     oleImgEdit1.HideAnnotationGroup
  877.     oleImgEdit1.Refresh
  878.     mnuHideAnnotation.Checked = True
  879. End If
  880.  
  881. End Sub
  882.  
  883. Private Sub mnuHiLight_Click()
  884. 'see documentation for the list of annotation types
  885. oleImgEdit1.SelectTool AnnoHiLight
  886.  
  887.  
  888. 'Check the current annotation tool and uncheck all
  889. 'the others
  890. mnuNoTool.Checked = False
  891. mnuSelectPointer.Checked = False
  892. mnuAttachNote.Checked = False
  893. mnuFillRect.Checked = False
  894. mnuFreeHand.Checked = False
  895. mnuHiLight.Checked = True
  896. mnuHollowRect.Checked = False
  897. mnuStamp.Checked = False
  898. mnuStraightLine.Checked = False
  899. mnuTextFromFile.Checked = False
  900. mnuTypedText.Checked = False
  901.  
  902. End Sub
  903.  
  904. Private Sub mnuHollowRect_Click()
  905. 'see documentation for the list of annotation types
  906. oleImgEdit1.SelectTool AnnoHollowRect
  907.  
  908.  
  909. 'Check the current annotation tool and uncheck all
  910. 'the others
  911. mnuNoTool.Checked = False
  912. mnuSelectPointer.Checked = False
  913. mnuAttachNote.Checked = False
  914. mnuFillRect.Checked = False
  915. mnuFreeHand.Checked = False
  916. mnuHiLight.Checked = False
  917. mnuHollowRect.Checked = True
  918. mnuStamp.Checked = False
  919. mnuStraightLine.Checked = False
  920. mnuTextFromFile.Checked = False
  921. mnuTypedText.Checked = False
  922.  
  923. End Sub
  924.  
  925. Private Sub mnuInsert_Click()
  926. 'Add your code here.
  927. MsgBox "Function to be implemented by user."
  928.  
  929. End Sub
  930.  
  931. Private Sub mnuLast_Click()
  932. 'Save current page if modified, then store the current
  933. 'page number and display the last page
  934. Dim page As Long 'number of last page
  935.  
  936. If oleImgEdit1.ImageModified = True Then
  937.     If MsgBox(ImageChanged, vbYesNo) = vbYes Then
  938.         mnuSave_Click
  939.     End If
  940. End If
  941. LastPage = oleImgEdit1.page
  942. page = oleImgEdit1.PageCount
  943. oleImgEdit1.page = page
  944. oleImgEdit1.Display
  945.  
  946. 'Update the selected page thumbnail
  947. oleImgThumbnail1.DeselectAllThumbs
  948. oleImgThumbnail1.ThumbSelected(oleImgEdit1.page) = True
  949.  
  950. End Sub
  951.  
  952. Private Sub mnuLeft_Click()
  953. 'Rotate image 90 degrees to the left
  954. oleImgEdit1.RotateLeft
  955.  
  956. End Sub
  957.  
  958. Private Sub mnuNew_Click()
  959. 'if the current image was modified, give the user
  960. 'a chance to save it, then open a new blank image
  961. 'of the same size.
  962. If oleImgEdit1.ImageModified = True Then
  963.     If MsgBox(ImageChanged, vbYesNo) = vbYes Then
  964.         mnuSave_Click
  965.     End If
  966. End If
  967. 'Use generic display values
  968. oleImgEdit1.DisplayBlankImage 500, 400, 200, 200, 1
  969. oleImgEdit1.Image = ""
  970. oleImgThumbnail1.Image = oleImgEdit1.Image
  971.  
  972.  
  973. 'Now that we have an image, enable the needed menus.
  974. mnuSaveAs.Enabled = True
  975. mnuSave.Enabled = True
  976. mnuPrint.Enabled = True
  977. mnuEdit.Enabled = True
  978. mnuView.Enabled = True
  979. mnuPage.Enabled = True
  980. mnuZoom.Enabled = True
  981. mnuAnnotation.Enabled = True
  982. 'This is a 1 page image, so disable the page
  983. 'change menu items
  984. mnuBack.Enabled = False
  985. mnuFirst.Enabled = False
  986. mnuGoTo.Enabled = False
  987. mnuLast.Enabled = False
  988. mnuNext.Enabled = False
  989. mnuPrevious.Enabled = False
  990.  
  991.  
  992.  
  993. End Sub
  994.  
  995. Private Sub mnuNext_Click()
  996. 'Save current page if modified, then store the current
  997. 'page number and display the next page
  998. Dim page As Long 'Page place holder
  999.  
  1000. If oleImgEdit1.ImageModified = True Then
  1001.     If MsgBox(ImageChanged, vbYesNo) = vbYes Then
  1002.         mnuSave_Click
  1003.     End If
  1004. End If
  1005. LastPage = oleImgEdit1.page
  1006. page = oleImgEdit1.page
  1007. If page = TotalPages Then
  1008.     MsgBox "Last Page"
  1009.     Exit Sub
  1010. End If
  1011. page = page + 1
  1012. oleImgEdit1.page = page
  1013. oleImgEdit1.Display
  1014.  
  1015. 'Update the selected page thumbnail
  1016. oleImgThumbnail1.DeselectAllThumbs
  1017. oleImgThumbnail1.ThumbSelected(oleImgEdit1.page) = True
  1018.  
  1019. End Sub
  1020.  
  1021. Private Sub mnuNoTool_Click()
  1022. 'see documentation for the list of annotation types
  1023. oleImgEdit1.SelectTool NoTool
  1024.  
  1025.  
  1026. 'Check the current annotation tool and uncheck all
  1027. 'the others
  1028. mnuNoTool.Checked = True
  1029. mnuSelectPointer.Checked = False
  1030. mnuAttachNote.Checked = False
  1031. mnuFillRect.Checked = False
  1032. mnuFreeHand.Checked = False
  1033. mnuHiLight.Checked = False
  1034. mnuHollowRect.Checked = False
  1035. mnuStamp.Checked = False
  1036. mnuStraightLine.Checked = False
  1037. mnuTextFromFile.Checked = False
  1038. mnuTypedText.Checked = False
  1039.  
  1040. End Sub
  1041.  
  1042. Private Sub mnuOnePage_Click()
  1043. 'hide any thumbnails and expand the Image Edit
  1044. 'window to fit in the form
  1045.  
  1046. oleImgThumbnail1.Visible = False
  1047. oleImgEdit1.Visible = True
  1048. oleImgEdit1.Left = frmSample.ScaleLeft
  1049. oleImgEdit1.Top = frmSample.ScaleTop
  1050. oleImgEdit1.Width = frmSample.ScaleWidth
  1051. oleImgEdit1.Height = frmSample.ScaleHeight
  1052.  
  1053. mnuThumbnail.Checked = False
  1054. mnuOnePage.Checked = True
  1055. mnuPageThumbnail.Checked = False
  1056.  
  1057. End Sub
  1058.  
  1059.  
  1060. Private Sub mnuOpen_Click()
  1061. 'open an image doc. If the current doc is modified,
  1062. 'try to save it. ShowFileDialog(0) shows Open File
  1063. 'dialog. ShowFileDialog(1) shows SaveAs File dialog.
  1064.  
  1065.  
  1066. Dim temp As String 'image name and path
  1067.  
  1068. On Error Resume Next 'handle errors ourselves incase of cancel
  1069. oleImgAdmin1.Flags = 0 'clear Flags
  1070. If oleImgEdit1.ImageModified = True Then
  1071.     If MsgBox(ImageChanged, vbYesNo) = vbYes Then
  1072.         mnuSave_Click
  1073.         If Err = ErrCancel Then '32755 = Cancel pressed
  1074.             Exit Sub
  1075.         End If
  1076.     End If
  1077. End If
  1078. oleImgAdmin1.ShowFileDialog 0, frmSample.hWnd
  1079. If Err = ErrCancel Then '32755 = Cancel pressed
  1080.     Exit Sub
  1081. End If
  1082. If oleImgAdmin1.StatusCode <> 0 Then
  1083.     MsgBox Err.Description + " Code = " + Hex(oleImgAdmin1.StatusCode), 16
  1084.     Exit Sub
  1085. End If
  1086. temp = oleImgAdmin1.Image
  1087. oleImgEdit1.Image = temp
  1088. oleImgThumbnail1.Image = oleImgEdit1.Image
  1089. If numbits > 8 Then 'video driver supports hicolor or truecolor
  1090.     oleImgEdit1.ImagePalette = 3 'Set for 24 bit RGB.
  1091. End If
  1092. oleImgEdit1.page = 1
  1093. oleImgEdit1.Display
  1094. TotalPages = oleImgEdit1.PageCount
  1095. oleImgThumbnail1.ThumbSelected(1) = True
  1096.  
  1097. 'Now that we have an image, enable the needed menus.
  1098. mnuSaveAs.Enabled = True
  1099. mnuSave.Enabled = True
  1100. mnuPrint.Enabled = True
  1101. mnuEdit.Enabled = True
  1102. mnuView.Enabled = True
  1103. mnuPage.Enabled = True
  1104. mnuZoom.Enabled = True
  1105. mnuAnnotation.Enabled = True
  1106. If oleImgEdit1.PageCount > 1 Then
  1107.     mnuBack.Enabled = True
  1108.     mnuFirst.Enabled = True
  1109.     mnuGoTo.Enabled = True
  1110.     mnuLast.Enabled = True
  1111.     mnuNext.Enabled = True
  1112.     mnuPrevious.Enabled = True
  1113. Else
  1114.     mnuBack.Enabled = False
  1115.     mnuFirst.Enabled = False
  1116.     mnuGoTo.Enabled = False
  1117.     mnuLast.Enabled = False
  1118.     mnuNext.Enabled = False
  1119.     mnuPrevious.Enabled = False
  1120. End If
  1121.  
  1122. End Sub
  1123.  
  1124. Private Sub mnuOptions_Click()
  1125. 'Add your code here.
  1126. MsgBox "Function to be implemented by user."
  1127.  
  1128. End Sub
  1129.  
  1130.  
  1131. Private Sub mnuPageThumbnail_Click()
  1132. 'Show the thumbnails accross the top third of the
  1133. 'app window, and the current image in the bottom two
  1134. 'thirds of the window.
  1135.  
  1136. oleImgEdit1.Visible = True
  1137. oleImgThumbnail1.Visible = True
  1138.  
  1139. oleImgEdit1.Left = frmSample.ScaleLeft
  1140. oleImgEdit1.Top = frmSample.ScaleHeight / 3
  1141. oleImgEdit1.Width = frmSample.ScaleWidth
  1142. oleImgEdit1.Height = (frmSample.ScaleHeight * 2 / 3)
  1143.  
  1144. oleImgThumbnail1.Left = frmSample.ScaleLeft
  1145. oleImgThumbnail1.Top = frmSample.ScaleTop
  1146. oleImgThumbnail1.Width = frmSample.ScaleWidth
  1147. oleImgThumbnail1.Height = frmSample.ScaleHeight / 3
  1148.  
  1149. mnuThumbnail.Checked = False
  1150. mnuOnePage.Checked = False
  1151. mnuPageThumbnail.Checked = True
  1152.  
  1153. End Sub
  1154.  
  1155. Private Sub mnuPaste_Click()
  1156. 'Paste from the clipboard
  1157. If oleImgEdit1.IsClipboardDataAvailable = True Then
  1158.     oleImgEdit1.ClipboardPaste
  1159.     Selection = False
  1160. End If
  1161.  
  1162. End Sub
  1163.  
  1164. Private Sub mnuPrevious_Click()
  1165. 'Save current page if modified, then store the current
  1166. 'page number and display the previous page
  1167. Dim page As Long 'Page number place holder
  1168.  
  1169. If oleImgEdit1.ImageModified = True Then
  1170.     If MsgBox(ImageChanged, vbYesNo) = vbYes Then
  1171.         mnuSave_Click
  1172.     End If
  1173. End If
  1174. LastPage = oleImgEdit1.page
  1175. page = oleImgEdit1.page
  1176. If page = 1 Then
  1177.     MsgBox "First Page"
  1178.     Exit Sub
  1179. End If
  1180. page = page - 1
  1181. oleImgEdit1.page = page
  1182. oleImgEdit1.Display
  1183.  
  1184. 'Update the selected page thumbnail
  1185. oleImgThumbnail1.DeselectAllThumbs
  1186. oleImgThumbnail1.ThumbSelected(oleImgEdit1.page) = True
  1187.  
  1188. End Sub
  1189.  
  1190. Private Sub mnuPrint_Click()
  1191. 'Open ImgAdmin's Print dialog and call ImgEdit's
  1192. 'Print function with the user selected options.
  1193. Dim format As Integer
  1194. Dim Annotations As Boolean
  1195.  
  1196. On Error Resume Next 'handle errors ourselves in case of cancel
  1197. If oleImgEdit1.ImageModified = True Then
  1198.     If MsgBox("The Image must be saved first if changes are to be printed.  Do you want to save the image?", vbYesNo) = vbYes Then
  1199.         mnuSave_Click
  1200.     End If
  1201. End If
  1202. oleImgAdmin1.Flags = 0 'clear Flags so print dialog box will display
  1203. oleImgAdmin1.ShowPrintDialog frmSample.hWnd
  1204. If oleImgAdmin1.StatusCode = 0 Then 'OK button selected
  1205.     format = oleImgAdmin1.PrintOutputFormat
  1206.     Annotations = oleImgAdmin1.PrintAnnotations
  1207.         X = oleImgEdit1.PrintImage(oleImgAdmin1.PrintStartPage, oleImgAdmin1.PrintEndPage, format, Annotations)
  1208. Else
  1209.     If Err = ErrCancel Then '32755 = Cancel pressed
  1210.         Exit Sub
  1211.     Else
  1212.         MsgBox Err.Description + " Code = " + Hex(oleImgAdmin1.StatusCode), 16
  1213.     End If
  1214. End If
  1215. If oleImgEdit1.StatusCode <> 0 Then
  1216.     MsgBox Err.Description + " Code = " + Hex(oleImgEdit1.StatusCode), 16
  1217. End If
  1218.  
  1219. End Sub
  1220.  
  1221. Private Sub mnuPrintPage_Click()
  1222. 'Print the current page.
  1223.  
  1224. On Error Resume Next 'handle errors ourselves
  1225. X = oleImgEdit1.PrintImage(oleImgEdit1.page, oleImgEdit1.page)
  1226. If oleImgEdit1.StatusCode <> 0 Then
  1227.     MsgBox Err.Description + " Code = " + Hex(oleImgEdit1.StatusCode), 16
  1228. End If
  1229.  
  1230. End Sub
  1231.  
  1232.  
  1233. Private Sub mnuRescan_Click()
  1234. 'Add your code here.
  1235. MsgBox "Function to be implemented by user."
  1236.  
  1237. End Sub
  1238.  
  1239.  
  1240. Private Sub mnuRight_Click()
  1241. 'Rotate image 90 degrees to the right
  1242. oleImgEdit1.RotateRight
  1243.  
  1244. End Sub
  1245.  
  1246. Private Sub mnuSave_Click()
  1247. 'Save the current document
  1248. On Error Resume Next 'handle errors ourselves
  1249. If oleImgEdit1.Image = "" Then
  1250.     mnuSaveAs_Click
  1251. Else
  1252.     oleImgEdit1.Save (False)
  1253.     If oleImgEdit1.StatusCode <> 0 Then
  1254.         MsgBox Err.Description + " Code = " + Hex(oleImgEdit1.StatusCode), 16
  1255.     End If
  1256. End If
  1257.  
  1258. End Sub
  1259.  
  1260. Private Sub mnuSaveAs_Click()
  1261. 'Open ImgAdmin's SaveAs dialog
  1262. Dim FileType As Integer
  1263.  
  1264. On Error Resume Next 'handle errors ourselves
  1265.  
  1266. 'we can write tiff, bmp, and awd files, so set the admin file filter
  1267. 'to show only these types.
  1268. oleImgAdmin1.Filter = "TIFF files (*.tif)|*.tif|BMP files (*.bmp)|*.bmp|AWD files(*.awd)|*.awd|"
  1269. oleImgAdmin1.ShowFileDialog 1, frmSample.hWnd
  1270. If Err = ErrCancel Then '32755 = Cancel pressed
  1271.     Exit Sub
  1272. End If
  1273.  
  1274. If oleImgAdmin1.Image = oleImgEdit1.Image Then 'Save as current name
  1275.     oleImgEdit1.Save False
  1276. Else 'Save as newly selected name and change image name to selected name
  1277.     'determine from the filter index which file type was selected
  1278.     If oleImgAdmin1.FilterIndex = 1 Then
  1279.         FileType = TiffImage
  1280.     ElseIf oleImgAdmin1.FilterIndex = 2 Then
  1281.         FileType = BmpImage
  1282.     Else
  1283.         FileType = AwdImage
  1284.     End If
  1285.     oleImgEdit1.SaveAs oleImgAdmin1.Image, FileType
  1286.     oleImgEdit1.Image = oleImgAdmin1.Image
  1287.     oleImgAdmin1.Image = oleImgEdit1.Image 'this forces a refresh of the properties in the Admin control
  1288.     
  1289. End If
  1290. oleImgAdmin1.FilterIndex = 0
  1291. oleImgAdmin1.Filter = ""
  1292. If oleImgEdit1.StatusCode <> 0 Then
  1293.     MsgBox Err.Description + " Code = " + Hex(oleImgEdit1.StatusCode), 16
  1294.     Exit Sub
  1295. End If
  1296.  
  1297. End Sub
  1298.  
  1299. Private Sub mnuScaleToGray_Click()
  1300. 'toggle image in 4 bit grayscale
  1301. If mnuScaleToGray.Checked = True Then
  1302.     oleImgEdit1.DisplayScaleAlgorithm = 0
  1303.     oleImgEdit1.Refresh
  1304.     mnuScaleToGray.Checked = False
  1305. Else
  1306.     oleImgEdit1.DisplayScaleAlgorithm = 2
  1307.     oleImgEdit1.Refresh
  1308.     mnuScaleToGray.Checked = True
  1309. End If
  1310. End Sub
  1311.  
  1312.  
  1313.  
  1314. Private Sub mnuSelect_Click()
  1315. 'Add your code here.
  1316. MsgBox "Function to be implemented by user."
  1317.  
  1318. End Sub
  1319.  
  1320.  
  1321. Private Sub mnuSelectPointer_Click()
  1322. 'see documentation for the list of annotation types
  1323. oleImgEdit1.SelectTool AnnoSelection
  1324.  
  1325.  
  1326. 'Check the current annotation tool and uncheck all
  1327. 'the others
  1328. mnuNoTool.Checked = False
  1329. mnuSelectPointer.Checked = True
  1330. mnuAttachNote.Checked = False
  1331. mnuFillRect.Checked = False
  1332. mnuFreeHand.Checked = False
  1333. mnuHiLight.Checked = False
  1334. mnuHollowRect.Checked = False
  1335. mnuStamp.Checked = False
  1336. mnuStraightLine.Checked = False
  1337. mnuTextFromFile.Checked = False
  1338. mnuTypedText.Checked = False
  1339.  
  1340. End Sub
  1341.  
  1342.  
  1343. Private Sub mnuSend_Click()
  1344. 'Add your code here.
  1345. MsgBox "Function to be implemented by user."
  1346.  
  1347. End Sub
  1348.  
  1349. Private Sub mnuShowTools_Click()
  1350. 'If the tool palette is visible, close it.  If it's
  1351. 'not visible, open it.
  1352. If Annot8Visible = True Then
  1353.     oleImgEdit1.HideAnnotationToolPalette
  1354.     Annot8Visible = False
  1355.     mnuShowTools.Checked = False
  1356. Else
  1357.     oleImgEdit1.ShowAnnotationToolPalette
  1358.     Annot8Visible = True
  1359.     mnuShowTools.Checked = True
  1360. End If
  1361.  
  1362. End Sub
  1363.  
  1364.  
  1365. Private Sub mnuStamp_Click()
  1366. 'Bring up the Rubber Stamp Properties dialog to choose the stamp you want.
  1367. oleImgEdit1.ShowRubberStampDialog
  1368.  
  1369.  
  1370.  
  1371. 'Check the current annotation tool and uncheck all
  1372. 'the others
  1373. mnuNoTool.Checked = False
  1374. mnuSelectPointer.Checked = False
  1375. mnuAttachNote.Checked = False
  1376. mnuFillRect.Checked = False
  1377. mnuFreeHand.Checked = False
  1378. mnuHiLight.Checked = False
  1379. mnuHollowRect.Checked = False
  1380. mnuStamp.Checked = True
  1381. mnuStraightLine.Checked = False
  1382. mnuTextFromFile.Checked = False
  1383. mnuTypedText.Checked = False
  1384.  
  1385. End Sub
  1386.  
  1387.  
  1388. Private Sub mnuStraightLine_Click()
  1389. 'see documentation for the list of annotation types
  1390. oleImgEdit1.SelectTool AnnoStraightLine
  1391.  
  1392.  
  1393. 'Check the current annotation tool and uncheck all
  1394. 'the others
  1395. mnuNoTool.Checked = False
  1396. mnuSelectPointer.Checked = False
  1397. mnuAttachNote.Checked = False
  1398. mnuFillRect.Checked = False
  1399. mnuFreeHand.Checked = False
  1400. mnuHiLight.Checked = False
  1401. mnuHollowRect.Checked = False
  1402. mnuStamp.Checked = False
  1403. mnuStraightLine.Checked = True
  1404. mnuTextFromFile.Checked = False
  1405. mnuTypedText.Checked = False
  1406.  
  1407. End Sub
  1408.  
  1409. Private Sub mnuTextFromFile_Click()
  1410. 'see documentation for the list of annotation types
  1411. oleImgEdit1.SelectTool AnnoTextFromFile
  1412.  
  1413.  
  1414.  
  1415. 'Check the current annotation tool and uncheck all
  1416. 'the others
  1417. mnuNoTool.Checked = False
  1418. mnuSelectPointer.Checked = False
  1419. mnuAttachNote.Checked = False
  1420. mnuFillRect.Checked = False
  1421. mnuFreeHand.Checked = False
  1422. mnuHiLight.Checked = False
  1423. mnuHollowRect.Checked = False
  1424. mnuStamp.Checked = False
  1425. mnuStraightLine.Checked = False
  1426. mnuTextFromFile.Checked = True
  1427. mnuTypedText.Checked = False
  1428.  
  1429. End Sub
  1430.  
  1431. Private Sub mnuThumbnail_Click()
  1432. 'Size the thumbnail window to the app window and
  1433. 'display it. Hide the image window.
  1434. oleImgThumbnail1.Left = frmSample.ScaleLeft
  1435. oleImgThumbnail1.Top = frmSample.ScaleTop
  1436. oleImgThumbnail1.Width = frmSample.ScaleWidth
  1437. oleImgThumbnail1.Height = frmSample.ScaleHeight
  1438. oleImgThumbnail1.Visible = True
  1439. oleImgEdit1.Visible = False
  1440. 'oleImgThumbnail1.Image = oleImgEdit1.Image
  1441. mnuThumbnail.Checked = True
  1442. mnuOnePage.Checked = False
  1443. mnuPageThumbnail.Checked = False
  1444.  
  1445. End Sub
  1446.  
  1447. Private Sub mnuToolbar_Click()
  1448. 'Add your code here.
  1449. MsgBox "Function to be implemented by user."
  1450.  
  1451. End Sub
  1452.  
  1453.  
  1454. Private Sub mnuTypedText_Click()
  1455. 'see documentation for the list of annotation types
  1456. oleImgEdit1.SelectTool AnnoText
  1457.  
  1458.  
  1459. 'Check the current annotation tool and uncheck all
  1460. 'the others
  1461. mnuNoTool.Checked = False
  1462. mnuSelectPointer.Checked = False
  1463. mnuAttachNote.Checked = False
  1464. mnuFillRect.Checked = False
  1465. mnuFreeHand.Checked = False
  1466. mnuHiLight.Checked = False
  1467. mnuHollowRect.Checked = False
  1468. mnuStamp.Checked = False
  1469. mnuStraightLine.Checked = False
  1470. mnuTextFromFile.Checked = False
  1471. mnuTypedText.Checked = True
  1472.  
  1473. End Sub
  1474.  
  1475. Private Sub mnuZoomIn_Click()
  1476. 'Double the size of the image view
  1477. Dim zoomval As Single 'zoom value
  1478.  
  1479. zoomval = oleImgEdit1.Zoom
  1480. zoomval = zoomval * 2
  1481. If zoomval < ZoomMax Then
  1482.     oleImgEdit1.Zoom = zoomval
  1483.     oleImgEdit1.Refresh
  1484. Else
  1485.     MsgBox "At maximum zoom"
  1486. End If
  1487.  
  1488. 'uncheck the zoom menu picks.
  1489. mnuBestFit.Checked = False
  1490. mnuFitHeight.Checked = False
  1491. mnuFitWidth.Checked = False
  1492. mnuActual.Checked = False
  1493. mnu25.Checked = False
  1494. mnu50.Checked = False
  1495. mnu75.Checked = False
  1496. mnu100.Checked = False
  1497. mnu200.Checked = False
  1498. mnu400.Checked = False
  1499. End Sub
  1500.  
  1501. Private Sub mnuZoomOut_Click()
  1502. 'Reduce the image by half
  1503. Dim zoomval As Single 'zoom value
  1504.  
  1505. zoomval = oleImgEdit1.Zoom
  1506. zoomval = zoomval / 2
  1507. If zoomval >= ZoomMin Then
  1508.     oleImgEdit1.Zoom = zoomval
  1509.     oleImgEdit1.Refresh
  1510. Else
  1511.     MsgBox "At minimum zoom"
  1512. End If
  1513.  
  1514.  
  1515. 'uncheck the zoom menu picks.
  1516. mnuBestFit.Checked = False
  1517. mnuFitHeight.Checked = False
  1518. mnuFitWidth.Checked = False
  1519. mnuActual.Checked = False
  1520. mnu25.Checked = False
  1521. mnu50.Checked = False
  1522. mnu75.Checked = False
  1523. mnu100.Checked = False
  1524. mnu200.Checked = False
  1525. mnu400.Checked = False
  1526. End Sub
  1527.  
  1528. Private Sub mnuZoomToSelection_Click()
  1529. 'Zoom the part of the image in selection
  1530. 'rect to the size of the image window
  1531. If Selection = True Then
  1532.     oleImgEdit1.ZoomToSelection
  1533. End If
  1534.  
  1535. 'check the current menu pick and uncheck the others.
  1536. mnuBestFit.Checked = False
  1537. mnuFitHeight.Checked = False
  1538. mnuFitWidth.Checked = False
  1539. mnuActual.Checked = False
  1540. mnu25.Checked = False
  1541. mnu50.Checked = False
  1542. mnu75.Checked = False
  1543. mnu100.Checked = False
  1544. mnu200.Checked = False
  1545. mnu400.Checked = False
  1546. End Sub
  1547.  
  1548. Private Sub oleImgEdit1_SelectionRectDrawn(ByVal Left As Long, ByVal Top As Long, ByVal Width As Long, ByVal Height As Long)
  1549. 'Determine if a selection rect has been drawn
  1550. If Width = 0 And Height = 0 Then
  1551.     Selection = False
  1552. Else
  1553.     Selection = True
  1554. End If
  1555. End Sub
  1556.  
  1557. Private Sub oleImgEdit1_ToolPaletteHidden(ByVal Left As Long, ByVal Top As Long)
  1558. 'The tool palette has been hidden.  Uncheck its menu item.
  1559.     Annot8Visible = False
  1560.     mnuShowTools.Checked = False
  1561.  
  1562. End Sub
  1563.  
  1564.  
  1565. Private Sub oleImgThumbnail1_Click(ByVal ThumbNumber As Long)
  1566. 'Change the displayed page to the one represented by
  1567. 'the thumbnail that the user clicked on
  1568. If ThumbNumber > 0 Then
  1569.     frmSample.oleImgEdit1.page = ThumbNumber
  1570.     frmSample.oleImgEdit1.Display
  1571.     frmSample.oleImgThumbnail1.DeselectAllThumbs
  1572.     frmSample.oleImgThumbnail1.ThumbSelected(ThumbNumber) = True
  1573. End If
  1574. End Sub
  1575.  
  1576.  
  1577.